---
title: "SQL-013: Update a task"
summary: Persist changes to an existing task via the pk82036_task.task_update stored procedure.
status: draft
owner: SAIF Documentation
last_reviewed: 2026-08-21
library: SAIF.Business.Tasks
reference_type: embedded
---

# SQL-013 Update a task

Updates the mutable columns of an existing `TASK` row by calling the Oracle stored procedure `pk82036_task.task_update`, protected by the `UPDATE_SEQ_NUM` optimistic-concurrency token.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-013 |
| **Operation type** | Update |
| **Execution method** | Stored procedure |
| **Database** | Oracle |
| **Schema** | `[unqualified]`** |
| **Command type** | StoredProcedure |
| **Business object** | `clsTask` |
| **Criteria property** | `UpdateSQL` |
| **Lifecycle method** | `BeforeUpdate` / `AfterUpdate` |

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:UpdateUser` | Input | `clsSmartString` | 30 | Set to `IDataPortalInfo.UserID` before the call |
| `:DeleteFlag` | Input | String | 1 | Completion/soft-delete flag |
| `:NotepadFlag` | Input | String | 1 | Notepad-entry flag |
| `:TaskUser` | Input | String | 30 | Assigned MailID |
| `:TaskActionCode` | Input | String | 5 | Action code |
| `:TaskCategoryCode` | Input | String | 30 | Category code |
| `:TaskDate` | Input | `clsSmartDate` | — | Task due date |
| `:TaskPriorityCode` | Input | String | 5 | Priority code |
| `:TaskText` | Input | String | 4000 | Task narrative text |
| `:PolicyNum` | Input | `clsSmartDecimal` | — | Optional policy number |
| `:ClaimID` | Input | `clsSmartDecimal` | — | Optional claim ID |
| `:ImageSeqNum` | Input | `clsSmartDecimal` | — | Optional imaging document sequence number |
| `:TaskSecurity` | Input | String | 30 | Security classification string |
| `:ContextDate` | Input | `clsSmartDate` | — | Context date value |
| `:ContextNum` | Input | `clsSmartDecimal` | — | Context numeric value |
| `:ContextCode` | Input | `clsSmartString` | 5 | Context code |
| `:ContextCategory` | Input | `clsSmartString` | 100 | Context category |
| `:ContextKey` | Input | `clsSmartString` | 100 | Context key |
| `:ContextText` | Input | `clsSmartString` | 4000 | Context text value |
| `:TaskSeqNum` | Input | Decimal | — | Primary key of the task row |
| `:UpdateSeqNum` | Input | Decimal | — | Optimistic-concurrency token ([BR-013](../business-rules.md#br-013-optimistic-concurrency-via-update-sequence-number)) |
| `:RowsAffected` | ReturnValue | Integer | N/A | Rows updated; checked by `AfterUpdate` ([BR-011](../business-rules.md#br-011-task-update-must-affect-exactly-one-row)) |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [TASK](../database-tables.md#task) | UPDATE | All mutable `TASK` columns except `TASK_SOURCE_CODE` (immutable after insert) |

## Sample SQL

```sql
-- CommandType.StoredProcedure, RequestType = NonQuery
CALL pk82036_task.task_update(
  :UpdateUser,
  :DeleteFlag,
  :NotepadFlag,
  :TaskUser,
  :TaskActionCode,
  :TaskCategoryCode,
  :TaskDate,
  :TaskPriorityCode,
  :TaskText,
  :PolicyNum,
  :ClaimID,
  :ImageSeqNum,
  :TaskSecurity,
  :ContextDate,
  :ContextNum,
  :ContextCode,
  :ContextCategory,
  :ContextKey,
  :ContextText,
  :TaskSeqNum,
  :UpdateSeqNum,
  :RowsAffected)
```

`:TaskSourceCode` is deliberately absent — the source system is immutable after insert. The procedure body resides in the Oracle database and was not retrieved in this environment.**

## Operations and processes
- [Update a task](../operations/update-task.md)
- [Save a task collection](../operations/save-task-collection.md)

## Business rules
- [BR-001: A task must have a Task Category Code](../business-rules.md#br-001-a-task-must-have-a-task-category-code)
- [BR-011: Task update must affect exactly one row](../business-rules.md#br-011-task-update-must-affect-exactly-one-row)
- [BR-013: Optimistic concurrency via UPDATE_SEQ_NUM](../business-rules.md#br-013-optimistic-concurrency-via-update-sequence-number)
- [BR-016: MailIDs are stored and compared trimmed and upper-cased](../business-rules.md#br-016-mailids-are-stored-and-compared-trimmed-and-upper-cased)

## Sources
- SAIF.Business.Tasks/clsTask.vb
